//
//  PreviewVC.m
//  BigJoy
//
//  Created by Rowling on 2017/7/19.
//  Copyright © 2017年 Rowling. All rights reserved.
//

#import "PreviewVC.h"
#import "SDCycleScrollView.h"
#import "SaveSuccessPreViewController.h"
@interface PreviewVC ()
@property (weak, nonatomic) IBOutlet UIView *cycleContentView;
@property (weak, nonatomic) IBOutlet UISlider *slider;
@property (nonatomic,strong) SDCycleScrollView *cycleView;
@end

@implementation PreviewVC

-(SDCycleScrollView *)cycleView {
    if(_cycleView == nil) {
        _cycleView = [[SDCycleScrollView alloc]init];
        _cycleView.autoScrollTimeInterval = 4;
        _cycleView.backgroundColor     = [UIColor whiteColor];
        _cycleView.pageDotColor = [UIColor clearColor];
        _cycleView.currentPageDotColor = [UIColor whiteColor];
        _cycleView.bannerImageViewContentMode = UIViewContentModeScaleAspectFit;

    }
    return  _cycleView;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"预览";
    [self.cycleContentView addSubview: self.cycleView];
    [self.slider setThumbImage:[UIImage imageNamed:@"slider-2"] forState:UIControlStateNormal];
    [self.slider setMinimumTrackTintColor:XMColor(245, 70, 70)];
    [self.cycleView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.top.equalTo(self.cycleContentView);
    }];
    self.cycleView.localizationImageNamesGroup = self.imgArray;
}
// 保存
- (IBAction)saveButtonClick:(id)sender {
    XMweakSelf;
    [CustomAlerView showMessageWith:@"保存后的作品将无法返回修改，您确定要保存作品吗?" leftStr:@"保存" leftAction:^{
        SaveSuccessPreViewController * vc = [SaveSuccessPreViewController new];
        vc.imgArray = weakSelf.imgArray;
        [weakSelf.navigationController pushViewController:vc animated:YES];
    }];
}


@end
